<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>后台首页</title>
    {Common::getCss('index_8.css,base.css,base_8.css')}
    {include 'stourtravel/public/public_js'}
    {Common::getScript('echarts.min.js,laydate/laydate.js')}
</head>
<body>


<div class="iframe-container clearfix">

    <div class="main-container clearfix">

        <div class="app-manage-container">
            <div class="app-manage-bar">
                <span class="manage-title">产品管理</span>
            </div>
            <div class="app-manage-wrap">
                <ul class="app-product-manage clearfix">

                    {php}
                    $_article=array();
                    $products = Model_Menu_New::get_config_by_pid(1);
                    $products = Model_Menu_New::ordey_by_nav($products);
                    {/php}

                    {loop $products $data}
                    {php}
                    if(in_array($data['typeid'],array(4,6,10,11,12,101,115,null))){$_article[]=$data;continue;}
                    $pinyin = DB::select()->from('model')->where("id","=",$data['typeid'])->execute()->get('pinyin');
                    {/php}
                    <li class="item {$pinyin}">
                        <div class="app-product-block ">
                            <a class="app-name-bar product_item" href="javascript:;" data-url="{$data['url']}" data-title="{$data['title']}">
                                <i class="icon"></i>
                                <span class="name">{$data['title']}</span>
                            </a>
                            <div class="app-info-list">
                                {if strpos($data['datainfo'],'1') !== false}
                                {php}
                                if(isset($data['order_id'])){
                                $node=Model_Menu_New::get_config_by_id($data['order_id']);
                                $nodeUrl=$node['url'];
                                } else{
                                $node=null;
                                }
                                {/php}

                                {if Model_Admin::check_right($node['id'])}
                                <a class="app-info-bar data_item" href="javascript:;" data-url="{$nodeUrl}" data-name="{$data['title']}订单">
                                            <span class="data fl">订单
                                                <i class="num red_box hide" id="channel_order_unview_{$data['typeid']}"></i>
                                            </span>
                                    <span class="data fr" id="channel_order_num_{$data['typeid']}"></span>
                                </a>
                                {else}
                                <a class="app-info-bar" href="javascript:;" >
                                    <span class="data fl"></span>
                                    <span class="data fr"></span>
                                </a>
                                {/if}
                                {else}
                                <a class="app-info-bar" href="javascript:;" >
                                    <span class="data fl"></span>
                                    <span class="data fr"></span>
                                </a>
                                {/if}

                                {if strpos($data['datainfo'],'2')!==false}
                                {if Model_Admin::check_right($data['question_id'])}
                                <a class="app-info-bar data_item" href="javascript:;" data-url="question/index/typeid/{$data['typeid']}/menuid/{$data['question_id']}" data-name="{$data['title']}咨询">
                                            <span class="data fl">咨询
                                                <i class="num red_box hide" id="channel_question_unans_num_{$data['typeid']}"></i>
                                            </span>
                                    <span class="data fr" id="channel_question_num_{$data['typeid']}"></span>
                                </a>
                                {else}
                                <a class="app-info-bar" href="javascript:;" >
                                    <span class="data fl"></span>
                                    <span class="data fr" ></span>
                                </a>
                                {/if}
                                {else}
                                <a class="app-info-bar" href="javascript:;" >
                                    <span class="data fl"></span>
                                    <span class="data fr" ></span>
                                </a>
                                {/if}


                                {if strpos($data['datainfo'],'3')!==false}
                                {if Model_Admin::check_right($data['comment_id'])}
                                <a class="app-info-bar data_item" href="javascript:;" data-url="{Model_Menu_New::get_commnet_url($data['typeid'])}" data-name="{$data['title']}评论">
                                        <span class="data fl" >评论
                                            <i class="num red_box hide" id="channel_comment_uncheck_num_{$data['typeid']}"></i>
                                        </span>
                                    <span class="data fr" id="channel_comment_num_{$data['typeid']}"></span>
                                </a>
                                {else}
                                <a class="app-info-bar" href="javascript:;" >
                                    <span class="data fl"></span>
                                    <span class="data fr" ></span>
                                </a>
                                {/if}
                                {else}
                                <a class="app-info-bar" href="javascript:;" >
                                    <span class="data fl"></span>
                                    <span class="data fr" ></span>
                                </a>
                                {/if}

                            </div>
                        </div>
                    </li>
                    {/loop}


                </ul>
            </div>
        </div>
        <!-- 产品管理 -->

        <div class="app-manage-container">
            <div class="app-manage-bar">
                <span class="manage-title">销售平台</span>
            </div>
            <div class="app-manage-wrap">
                <ul class="app-platform-manage clearfix">
                    {php}
                    $platform = Model_Menu_New::get_config_by_pid(2);
                    $result = [];
                    foreach ($platform as $key => $value) {

                    if (in_array($value['title'],['新版 H5','老版 H5','移动通用设置'])) {

                    $result[] = $value;
                    unset($platform[$key]);
                    }
                    }
                    $tmp = [$result] + $platform;
                    $platform = $tmp;
                    {/php}

                    {loop $platform $k $v}
                    {if $k==0}
                    <li class="item">
                        <div class="platform-info-block">
                            <i class="icon mobile"></i>
                            <div class="platform-info-wrap">
                                {loop $platform[0] $k1 $v1}
                                <a href="javascript:;" class="tit config_item"  data-url="{$v1['url']}" {if isset($v1['alias_title'])}data-title="{$v1['alias_title']}"{/if} >{$v1['title']}</a>
                                {/loop}
                            </div>
                        </div>
                    </li>
                    {else}
                    <li class="item">
                        <a href="javascript:;" class="platform-info-block config_item" data-url="{$v['url']}" {if isset($v['alias_title'])}data-title="{$v['alias_title']}"{/if}>
                        <i class="icon {$v['ico']}"></i>
                        <span class="tit">{$v['title']}</span>
                        </a>
                    </li>
                    {/if}
                    {/loop}
                </ul>
            </div>
        </div>
        <!-- 销售平台 -->

        <div class="app-manage-container">
            <div class="app-manage-bar">
                <span class="manage-title">营销管理</span>
            </div>
            <div class="app-manage-wrap">
                <div class="app-article-item">
                    <div class="app-article-title">活动营销</div>
                    {php}
                    $_huodong = Model_Menu_New::get_config_by_title('活动营销');
                    $huodong =  Model_Menu_New::get_config_by_pid($_huodong[0]['id']);
                    {/php}
                    <ul class="app-article-manage clearfix">
                        {loop $huodong $v}
                        <li class="item">
                            <a href="javascript:" class="article-info-block article_item"  data-url="{$v['url']}" {if isset($v['alias_title'])}data-title="{$v['alias_title']}"{/if} >{$v['title']}</a>
                        </li>
                        {/loop}
                    </ul>
                </div>


                <div class="app-article-item">
                    <div class="app-article-title">内容营销</div>
                    {php}
                    $_neirong = Model_Menu_New::get_config_by_title('内容营销');
                    $neirong =  Model_Menu_New::get_config_by_pid($_neirong[0]['id']);
                    {/php}

                    <ul class="app-article-manage clearfix">
                        {loop $neirong $data}
                        <li class="item">
                            <span class="article-info-block">
                                <a href="javascript:" class="data fl article_item" data-url="{$data['url']}" {if isset($data['alias_title'])}data-title="{$data['alias_title']}"{/if}>{$data['title']}</a>

                                {if strpos($data['datainfo'],'1') !== false}
                                    {php}
                                    $total_id = "channel_order_num_".$data['typeid'];
                                    $unread_id = "channel_order_unview_".$data['typeid'];
                                    $link_title = $data['title'].'订单';
                                    if($data['typeid']==14)
                                    {
                                        $link_url = 'order/dz/typeid/'.$data['typeid'].'/menuid/'.$data['order_id'];
                                    }
                                    elseif($data['typeid']==11)
                                    {
                                        //结伴特殊处理
                                        $link_url = $data['url'];
                                        $link_title = $data['title'].'列表';
                                    }
                                    else
                                    {
                                        $link_url = 'order/index/typeid/'.$data['typeid'].'/menuid/'.$data['order_id'];
                                    }
                                    {/php}
                                {elseif strpos($data['datainfo'],'2')!==false}
                                    {php}
                                    $total_id = "channel_question_num_".$data['typeid'];
                                    $unread_id = "channel_question_unans_num_".$data['typeid'];
                                    $link_url = $data['typeid']==10 ? $data['url'] : "question/index/typeid/".$data['typeid']."/menuid/".$data['question_id'];
                                    $link_title = $data['title'].咨询;
                                    {/php}
                                {elseif strpos($data['datainfo'],'3')!==false}
                                    {php}
                                     $total_id = "channel_comment_num_".$data['typeid'];
                                     $unread_id = "channel_comment_uncheck_num_".$data['typeid'];
                                     $link_url = Model_Menu_New::get_commnet_url($data['typeid']);
                                     $link_title = $data['title'].'评论';
                                    {/php}
                                {/if}
                                <a href="#" class="num data_item hide" id="{$unread_id}" data-url="{$link_url}" data-name="{$link_title}"></a>
                                <a href="#" class="total fr data_item" id="{$total_id}" data-url="{$link_url}" data-name="{$link_title}"></a>
                            </span>
                        </li>

                        {/loop}
                    </ul>
                </div>



                <div class="app-article-item">
                    <div class="app-article-title">会员营销</div>
                    {php}
                    $_member = Model_Menu_New::get_config_by_title('会员营销');
                    $_member_menu =  Model_Menu_New::get_config_by_pid($_member[0]['id']);
                    {/php}
                    <ul class="app-article-manage clearfix">
                        {loop $_member_menu $data}
                        <li class="item">
                                <span class="article-info-block">
                                    <a href="javascript:" class="data fl article_item" data-url="{$data['url']}" {if isset($data['alias_title'])}data-title="{$data['alias_title']}"{/if}>{$data['title']}</a>
                                </span>
                        </li>
                        {/loop}
                    </ul>
                </div>
            </div>
        </div>
        <!-- 营销管理 -->

        <div class="app-chart-container clearfix">
            <div class="app-chart-block">
                <div class="app-chart-wrap">
                    <div class="app-manage-bar">
                        <span class="manage-title">订单统计</span>
                    </div>
                    <div class="app-date-box clearfix ">
                        <div class="choose-start-date date-list">
                            <input type="text" class="date-text starttime" id="starttime"  value="{$starttime}">
                            <i class="date-icon"></i>
                        </div>
                        <div class="choose-txt">至</div>
                        <div class="choose-start-date date-list">
                            <input type="text" class="date-text endtime" id="endtime" value="{$endtime}">
                            <i class="date-icon"></i>
                        </div>
                        <select name="" class="date-select" id="model_id">
                            {loop $models $v}
                            <option value="{$v['id']}">{$v['modulename']}</option>
                            {/loop}
                        </select>
                    </div>
                    <div class="app-chart-box" id="ordersChart"></div>
                </div>
            </div>
            <!-- 订单统计 -->

            <div class="app-chart-block">
                <div class="app-chart-wrap">
                    <div class="app-manage-bar">
                        <span class="manage-title">会员统计</span>
                    </div>
                    <div class="app-date-box clearfix">
                        <div class="choose-start-date date-list2">
                            <input type="text" class="date-text starttime2" id="starttime2"  value="{$starttime}">
                            <i class="date-icon"></i>
                        </div>
                        <div class="choose-txt">至</div>
                        <div class="choose-start-date date-list2">
                            <input type="text" class="date-text endtime2" id="endtime2" value="{$endtime}">
                            <i class="date-icon"></i>
                        </div>
                    </div>
                    <div class="app-chart-box" id="memberChart"></div>
                </div>
            </div>
            <!-- 会员统计 -->

        </div>
        <!-- 图表统计 -->

    </div>
    <!-- 主体内容 -->

    <div class="side-container">

        <div class="side-other-module hide" id="authorize_info">
            <div class="side-hd">系统版本<i class="msg-icon hide"></i></div>
            <div class="side-bd" id="myversion"></div><span id="version_tag" style="margin-left: 10px"></span>
            {if $roleid==1}
            <a href="javascript:;" class="side-fd"  onclick="ST.Util.addTab('升级管理','{$cmsurl}systemparts/upgrade_manager/menuid/192')">立即升级</a>
            {/if}
        </div>

        <div class="side-other-module hide" id="unauthorize_info">
            <h3 class="sidle-tit">版权信息</h3>
            <div class="sidle-con">
                <div class="side-bd" style="width: auto;color: red">
                    <span class="txt"><i class="icon"></i>您所使用的系统是盗版系统，对此我们保留起诉权利，将进行严厉打击！</span>请您购买正版系统，享受专业服务。
                </div>
            </div>
            <div class="side-menu-bar">
                <a class="btn-link" href="http://www.stourweb.com/cms/goumai" target="_blank">立即购买</a>
            </div>
        </div>
        <!-- 通知、公告 -->

        {php}
        $_zhandian = Model_Menu_New::get_config_by_title('站点管理');
        $right_menu = Model_Menu_New::get_config_by_pid(0,array(1,2,6,7,$_zhandian[0]['id'],$_neirong[0]['id'],$_huodong[0]['id'],$_member[0]['id']));
        {/php}

        <div class="sidle-module">
            <h3 class="sidle-tit">更多功能</h3>
            <div class="sidle-con">
                {loop $right_menu $k $v}
                {php}
                if($v['title']=='图片服务器' || $v['title'] == '城市站点'){
                continue;
                }
                {/php}
                <div class="sidle-item">
                    <div class="sidle-item-tit">{$v['title']}</div>
                    <div class="sidle-item-lis">
                        {loop Model_Menu_New::get_config_by_pid($v['id']) $sub}
                        {if $sub['title']!='产品接口' ||($sub['title']=='产品接口' && $sub['child_id']) }
                        <a class="item config_item" href="javascript:;" data-url="{$sub['url']}" {if isset($sub['alias_title'])}data-title="{$sub['alias_title']}"{/if}>{$sub['title']}</a>
                        {/if}
                        {/loop}
                    </div>
                </div>
                {/loop}

            </div>
        </div>
        <!-- 菜单管理 -->

        <!--        <div class="side-other-module">-->
        <!--            <div class="side-hd">营销内容</div>-->
        <!--            <ul class="side-article-list">-->
        <!--                <li><a href="#">移动端适配方案浅析</a></li>-->
        <!--                <li><a href="#">网站促销活动类图标分享</a></li>-->
        <!--                <li><a href="#">中秋&国庆，双节同庆，优惠这次很大！</a></li>-->
        <!--                <li><a href="#">旅游网站如何设计优秀的网站导航</a></li>-->
        <!--                <li><a href="#">旅游网站如何设计一款优秀的首页Banner图？</a></li>-->
        <!--                <li><a href="#">思途CMS 7.0全新升级，来看看都有哪些新变化！</a></li>-->
        <!--                <li><a href="#">如何提高网站用户的停留时间，降低跳出率</a></li>-->
        <!--                <li><a href="#">思途 CMS：既懂旅游，又懂互联网的旅游网站系统 | 创…</a></li>-->
        <!--                <li><a href="#">旅游电商网站运营之优惠券营销</a></li>-->
        <!--                <li><a href="#">私人定制游，未来旅游市场发展趋势</a></li>-->
        <!--            </ul>-->
        <!--        </div>-->
        <!-- 营销内容 -->

    </div>
    <!-- 边栏导航 -->


</div>
<!-- 框架部分 -->
<script>

    $(function(){

        //获取订单,问答,评论数量
        $.ajax({
            type: 'POST',
            url: SITEURL + 'index/ajax_order_num?'+Math.random(),
            dataType: 'json',
            success: function (data) {
                $.each(data, function (i, row) {
                    $("#channel_order_num_"+row.typeid).text(row.num);
                    if (parseInt(row.unviewnum) >0 ) {
                        $("#channel_order_unview_" + row.typeid).text(row.unviewnum);
                        $("#channel_order_unview_" + row.typeid).removeClass('hide');
                    }else{
                        $("#channel_order_unview_" + row.typeid).addClass('hide');
                    }
                    //评论数量
                    if(parseInt(row.comment_num) >= 0){
                        $("#channel_comment_num_" + row.typeid).text(row.comment_num);
                    }else{
                        $("#channel_comment_num_" + row.typeid).addClass('hide');
                    }
                    //未审核评论
                    if(parseInt(row.comment_uncheck_num) > 0){
                        $("#channel_comment_uncheck_num_" + row.typeid).text(row.comment_uncheck_num);
                        $("#channel_comment_uncheck_num_" + row.typeid).removeClass('hide');
                    }else{
                        $("#channel_comment_uncheck_num_" + row.typeid).addClass('hide');
                    }
                    //提问数量
                    if(parseInt(row.question_num) >= 0){
                        $("#channel_question_num_" + row.typeid).text(row.question_num);
                        $("#channel_question_num_" + row.typeid).removeClass('hide');
                    }else{
                        $("#channel_question_num_" + row.typeid).addClass('hide');
                    }
                    //未回复数量
                    if(parseInt(row.question_unans_num) > 0){
                        $("#channel_question_unans_num_" + row.typeid).text(row.question_unans_num);
                        $("#channel_question_unans_num_" + row.typeid).removeClass('hide');
                    }else{
                        $("#channel_question_unans_num_" + row.typeid).addClass('hide');
                    }
                    if(parseInt(row.channel_call_untreated_num)>0)
                    {
                        $('#channel_call_untreated_num').text(row.channel_call_untreated_num)
                        $('#channel_call_untreated_num').removeClass('hide')
                    } else {

                        $('#channel_call_untreated_num').addClass('hide')
                    }
                })
            }
        })

        //链接跳转
        $('.product_item,.config_item,.article_item').click(function(){
            var url = $(this).attr('data-url');
            var data_title=$(this).attr('data-title');
            var title =typeof(data_title)=='undefined'?$(this).text():data_title;
            let new_window=['应用商城','模板商城','营销服务','服务合同']
            if (new_window.includes(title)) {
                $.ajax({
                    url: SITEURL + url,
                    dataType: 'json',
                    success: function (resp) {
                        if(resp.status){
                            window.open(resp.data)
                        }
                    }
                })
            }else{
                ST.Util.addTab(title, url);
            }
        })

        //评论,订单,咨询跳转
        $(".data_item").click(function(){
            var url = $(this).data('url');
            var title = $(this).data('name');
            ST.Util.addTab(title,url);
        })

        //right check
        checkRightV();

        //调用函数判断
        var mb = myBrowser();

        if ("IE" == mb) {
            function resizeWindow(){
                $(window).resize(function(){
                    $(".main-container").width($(".iframe-container").width()-465);
                })
            }
            resizeWindow();
            $(".main-container").width($(".iframe-container").width()-465);
        }

        if ("FF" == mb) {
            function resizeWindow(){
                $(window).resize(function(){
                    $(".main-container").width($(".iframe-container").width()-465);
                })
            }
            resizeWindow();
            $(".main-container").width($(".iframe-container").width()-465);
        }

        if ("Chrome" == mb) {
            function resizeWindow(){
                $(window).resize(function(){
                    $(".main-container").width($(".iframe-container").width()-450);
                })
            }
            resizeWindow();
            $(".main-container").width($(".iframe-container").width()-450);
        }

        if ("Opera" == mb) {

            function resizeWindow(){
                $(window).resize(function(){
                    $(".main-container").width($(".iframe-container").width()-465);
                })
            }
            resizeWindow();
            $(".main-container").width($(".iframe-container").width()-465);
        }

        if ("Safari" == mb) {

            function resizeWindow(){
                $(window).resize(function(){
                    $(".main-container").width($(".iframe-container").width()-465);
                })
            }
            resizeWindow();
            $(".main-container").width($(".iframe-container").width()-465);
        }

        //通知公告
        $(".side-tab-module").each(function(){
            $(this).find(".tab-module-con").eq(0).show();
            $(this).find(".side-hd .item").on("click",function(){
                $(this).addClass("on").siblings().removeClass("on");
                var index = $(this).index();
                $(this).parent().next().children(".tab-module-con").eq(index).show().siblings().hide()
            });
        });

        // 订单统计
        orderCount()

        //会员统计
        memberCount()

        laydate.render({
            elem: '.date-list',
            range: ['.starttime', '.endtime'],
            theme: '#2196f3',
            done:function(value,date){
                orderCount(value)
            }
        });
        laydate.render({
            elem: '.date-list2',
            range: ['.starttime2', '.endtime2'],
            theme: '#2196f3',
            done:function(value,date){
                memberCount(value)
            }
        });

        $('#model_id').change(function (){
            orderCount()
        })

    })

    var SITEURL = URL = '{php echo URL::site();}';

    //浏览器判断
    function myBrowser(){
        var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
        var isOpera = userAgent.indexOf("Opera") > -1;
        if (isOpera) {
            return "Opera"
        } //判断是否Opera浏览器
        if (userAgent.indexOf("Firefox") > -1) {
            return "FF";
        } //判断是否Firefox浏览器
        if (userAgent.indexOf("Chrome") > -1){
            return "Chrome";
        }
        if (userAgent.indexOf("Safari") > -1) {
            return "Safari";
        } //判断是否Safari浏览器
        if (!!window.ActiveXObject || "ActiveXObject" in window) {
            return "IE";
        } //判断是否IE浏览器
    }

    //检测正版授权
    function checkRightV() {
        $.ajax({
            url: SITEURL + "upgrade/ajax_check_right/systempart/{php echo Model_SystemParts::$coreSystemPartCode}",
            dataType: 'json',
            success: function (data) {
                if (data.status == 1) {
                    $('#authorize_info').removeClass('hide');
                    //获取是否有更新
                    $.ajax({
                        url: SITEURL + "upgrade/ajax_check_all_systempart_update",
                        dataType: 'json',
                        success: function (data) {
                            var newico = "<img src=\"{$GLOBALS['cfg_public_url']}images/level-up-icon.png\" />";
                            var v = "V"+data.core_system_version;
                            if (data.status == 1) {
                                $("#myversion").text(v);
                                $("#version_tag").html(newico);
                                $('.msg-icon').removeClass('hide');
                            }
                            else {
                                $("#myversion").html(v);
                            }
                        }});
                }
                else {
                    $('#unauthorize_info').removeClass('hide');
                    ST.Util.showBox('绑定授权', SITEURL + 'index/dialog_unauthorize', 520, 130, null, null, document);
                }
            }});
    }

    //订单统计
    function orderCount(value){
        let starttime=''
        let endtime=''
        if(value){
            let dates = value.split(' - ');
            starttime = dates[0];
            endtime = dates[1];
        }else{
            starttime= $('#starttime').val()
            endtime= $('#endtime').val()
        }
        let model_id= $('#model_id').val()
        $.ajax({
            url: SITEURL + "index/ajax_order_count",
            dataType: 'json',
            type: 'POST',
            data: {starttime:starttime,endtime:endtime,model_id:model_id},
            success: function (resp) {
                if(!resp.status){
                    ST.Util.showMsg(resp.msg,5,2000);
                    return false
                }
                order_table(resp.data.money_list,resp.data.date_section,resp.data.num_list)
            }
        })
    }

    //订单统计echart
    var chartDomOrder = document.getElementById('ordersChart');
    var ordersChart = echarts.init(chartDomOrder);
    function order_table(money_list,date_section,num_list){
        var colors = ['#ff5e5e', '#2196f3'];
        var optionOrder = {
            color: colors,
            tooltip: {
                trigger: 'axis',
                axisPointer: {
                    type: 'cross'
                },
                backgroundColor: "rgba(0,0,0,0.8)",
                padding: 10,
                textStyle:{
                    color: '#fff',
                    fontSize: '9',
                    lineHeight: 56,
                }
            },
            grid: {
                show:true,
                left: '6%',
                right: '8%',
                bottom: '10%',
                backgroundColor: "#f9fafc",
                borderColor: "transparent"
            },
            toolbox: {
                feature: {
                    dataView: { show: true, readOnly: false },
                    restore: { show: true },
                    saveAsImage: { show: true }
                }
            },
            legend: {
                data: ['金额', '笔数'],
                top: 20,
                itemWidth: 14,
                itemHeight: 10,
                textStyle:{
                    fontSize: 12
                }
            },
            xAxis: [
                {
                    type: 'category',
                    axisTick: {
                        alignWithLabel: true
                    },
                    axisLine: {
                        show: true,
                        lineStyle: {
                            color: '#666'
                        }
                    },
                    data: date_section
                }
            ],
            yAxis: [
                {
                    type: 'value',
                    name: '元',
                    position: 'left',
                    alignTicks: true,
                    axisTick:{
                        show: false
                    },
                    axisLine: {
                        show: false,
                        lineStyle: {
                            color: '#666'
                        }
                    },
                    splitLine: {
                        show: true,
                        lineStyle: {
                            color: '#e5e5e5',
                            width: 1,
                            type: 'solid'
                        }
                    },
                    axisLabel: {
                        formatter: '{value}'
                    }
                },
                {
                    type: 'value',
                    name: '笔',
                    position: 'right',
                    alignTicks: true,
                    axisTick:{
                        show: false
                    },
                    axisLine: {
                        show: false,
                        lineStyle: {
                            color: '#666'
                        }
                    },
                    splitLine: {
                        show: false
                    },
                    axisLabel: {
                        formatter: '{value}'
                    }
                }
            ],
            series: [
                {
                    name: '金额',
                    type: 'line',
                    data: money_list
                },
                {
                    name: '笔数',
                    type: 'bar',
                    barWidth: '20%',
                    yAxisIndex: 1,
                    data: num_list
                },
            ]
        };
        optionOrder && ordersChart.setOption(optionOrder);
    }

    //会员统计
    function memberCount(value){
        let starttime=''
        let endtime=''
        if(value){
            let dates = value.split(' - ');
            starttime = dates[0];
            endtime = dates[1];
        }else{
            starttime= $('#starttime').val()
            endtime= $('#endtime').val()
        }
        $.ajax({
            url: SITEURL + "index/ajax_member_count",
            dataType: 'json',
            type: 'POST',
            data: {starttime:starttime,endtime:endtime},
            success: function (resp) {
                if(!resp.status){
                    ST.Util.showMsg(resp.msg,5,2000);
                    return false
                }
                member_table(resp.data.data_list,resp.data.date_section)
            }
        })
    }


    var chartDomMember = document.getElementById('memberChart');
    var memberChart = echarts.init(chartDomMember);
    function member_table(data_list,date_section){

        var optionMember = {
            tooltip: {
                trigger: 'axis',
                axisPointer: {
                    type: 'cross'
                },
                backgroundColor: "rgba(0,0,0,0.8)",
                padding: 10,
                textStyle:{
                    color: '#fff',
                    fontSize: '9'
                }
            },
            grid: {
                show:true,
                left: '9%',
                right: '5%',
                bottom: '10%',
                backgroundColor: "#f9fafc",
                borderColor: "transparent"
            },
            toolbox: {
                feature: {
                    dataView: { show: true, readOnly: false },
                    restore: { show: true },
                    saveAsImage: { show: true }
                }
            },
            legend: {
                data: '人数',
                left: '20%',
                top: 20
            },
            xAxis: [
                {
                    type: 'category',
                    axisTick: {
                        alignWithLabel: true
                    },
                    axisLine: {
                        show: true,
                        lineStyle: {
                            color: '#666'
                        }
                    },
                    data: date_section
                }
            ],
            yAxis: [
                {
                    type: 'value',
                    name: '人',
                    position: 'left',
                    alignTicks: true,
                    axisTick:{
                        show: false
                    },
                    axisLine: {
                        show: false,
                        lineStyle: {
                            color: '#666'
                        }
                    },
                    splitLine: {
                        show: true,
                        lineStyle: {
                            color: '#e5e5e5',
                            width: 1,
                            type: 'solid'
                        }
                    },
                    axisLabel: {
                        formatter: '{value}'
                    }
                }
            ],
            series: [
                {
                    name: '人数',
                    type: 'line',
                    smooth: true,
                    lineStyle: {
                        color: '#1bd193'
                    },
                    itemStyle: {
                        // 设置线条上点的颜色（和图例的颜色）
                        normal: {
                            color: '#1bd193',
                        },
                    },

                    data: data_list
                }
            ]
        };
        optionMember && memberChart.setOption(optionMember);
    }

    $(window).on("resize", function () {
        ordersChart.resize();
        memberChart.resize();
    });

    window.onload=function(){
        ordersChart.resize();
        memberChart.resize();
    }
</script>
</body>
</html>